/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024.
 * Description: rtos exception table
 * Author: wanglinhui <wanglinhui@huawei.com>
 * Create: 2024-06-13
 */
#include <linux/extable.h>
#include <linux/uaccess.h>

bool fixup_exception_rtos(struct pt_regs *regs)
{
	const struct exception_table_entry *fixup;

	fixup = search_rtos_exception_tables(instruction_pointer(regs));
	if (fixup) {
		regs->ARM_pc = (unsigned long)&fixup->fixup + fixup->fixup;
#ifdef CONFIG_THUMB2_KERNEL
		/* Clear the IT state to avoid nasty surprises in the fixup */
		regs->ARM_cpsr &= ~PSR_IT_MASK;
#endif
	}

	return fixup != NULL;
}
